package com.lagou.edu.wwyan.web1.minicat;

import java.util.ArrayList;
import java.util.List;

public class Server implements LifeCycle{
    /**
     * 这里 暂时只有一个service
     */
    private List<Service> services = new ArrayList<>();

    public Server() {
    }

    public void addService(Service service){
        services.add(service);
    }

    @Override
    public void init() {

        for (Service service : services) {
            service.init();
        }
    }

    @Override
    public void start() throws Exception {
        for (Service service : services) {
            service.start();
        }
    }
}
